<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>学校在线考试系统</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
	<link href="css/login.css" rel="stylesheet">
	<link href="css/font-awesome.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<%if(session.getAttribute("teacher")!=null){
	response.sendRedirect("tch_single");
} %>
  </head>
  <body>
    <div class="container">
		<div class="row" style="margin-top:17%;">
			<div class="col-md-offset-3 col-md-6">
				<form class="form-horizontal" action="teacher/login" method="post" id="tchLogin">
					<span class="heading">学校在线考试系统--教师端登录</span>
					<div class="form-group">
						<input type="text" class="form-control" id="inputNum" name="num" required="required" placeholder="用户名">
						<i class="fa fa-user"></i>
					</div>
					<div class="form-group help">
						<input type="password" class="form-control" id="inputPassword" name="password" required="required" placeholder="密　码">
						<i class="fa fa-lock"></i>
					</div>
					<div class="form-group">
						<button type="submit" value="Submit" class="btn btn-default">登录</button>
					</div>
				</form>
			</div>
		</div>
	</div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery-form.js"></script>
    <script type="text/javascript">
    $('#tchLogin').submit(function() {
    	  $(this).ajaxSubmit(function(data){
    		  if(data.success){
    			  alert(data.msg);
    			  $(location).attr('href', 'tch_single');
    		  }else{
    			  alert(data.msg);
    		  }
    	  });
    	  return false; 
    	  //非常重要，如果是false，则表明是不跳转
    	  //在本页上处理，也就是ajax，如果是非false，则传统的form跳转。
    	});
    </script>
  </body>
</html>